let body = document.querySelector("body");

body.addEventListener("click", function (evt) {
  target = evt.target;
  //---------------------get-------------------------------
  if (target.className.includes("get")) {
    console.log("get");
  }
  //---------------------post-------------------------------
  if (target.className.includes("post")) {
    let options = {
      url: "http://localhost:3000/users",
      method: "POST",
      data: {
        uid: "641",
        password: "asds3",
      },
      headers: { "Content-Type": "application/json" },
    };

    ajax(options);
    console.log("post");
  }
  //---------------------put-------------------------------
  if (target.className.includes("put")) {
    let options = {
      url: "http://localhost:3000/users/2",
      method: "PUT",
      data: {
        uid: "641",
        password: "put",
      },
      headers: { "Content-Type": "application/json" },
    };

    ajax(options);
  }
  //---------------------delete-------------------------------
  if (target.className.includes("delete")) {
    let options = {
      url: "http://localhost:3000/users/5",
      method: "DELETE",
    };

    ajax(options);
  }
  //---------------------patch-------------------------------
  if (target.className.includes("patch")) {
    console.log("patch");
  }
});
